<?php

include_once 'modelo/dbm_pdo.php';


// classe PDO
class modelo_conn_pdo {

    protected static $conn  = NULL;
    public static $host     = 'localhost';
    public static $usuario  = 'root';
    public static $senha    = 'vertrigo';
    public static $banco    = 'galeria';

    /**
     *
     * @return modelo_dbm_pdo
     */
    public static function get_conn() {
        if (self::$conn == NULL) {
            self::$conn = new modelo_dbm_pdo(array(
                self::$host,
                self::$usuario,
                self::$senha,
                self::$banco
            ));
        }
        return self::$conn;
    }
}

$c = modelo_conn_pdo::get_conn();
$c->beginTransaction();


try {
    $r = $c->exec("
        INSERT INTO usuario (id, nome, login_usuario, login_senha, is_admin, is_fotografo) 
        VALUES (NULL, '', 'a', 'a', 1, 0);");

    echo "id = " . $c->lastInsertId();
    $c->commit();
} catch (PDOQueryException $ex) {
    echo $ex->getMessage();
    $c->rollBack();
}


?>